package com.yanxml.spring.history.v3.demo4_import_bean_definition_registar.import_bean_definition_registar;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class MyBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        RootBeanDefinition logger = new RootBeanDefinition(Logger.class);
        registry.registerBeanDefinition("logger666", logger);

        RootBeanDefinition cacheBeanDefinition = new RootBeanDefinition(Cache.class);
        registry.registerBeanDefinition("cache", cacheBeanDefinition);
    }
}
